<#import "/macro.ftl" as m>
<@m.page_header title='后台' />
<div id="page-content-wrapper">

<div id="page-title">

    <h3>
        网站数据分析
    </h3>
</div>
<div id="page-content">
		<form id="form" action="/stat/websiteanalyse" method="get">
    		<div class="form-row">
    			<div class="form-input col-md-2">
    			<label for="from">
                    From:
                </label>
    				<#if startTime>
            		<input type="text"   name="startTime" data-trigger="focus" data-required="true" class="parsley-validated" value="${startTime}" onClick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})" style="clear:both;overflow:hidden;display:block">
          			<#else>
    				<input placeholder="起始时间" type="text"   name="startTime" data-trigger="focus" data-required="true" class="parsley-validated" value="" onClick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})" style="clear:both;overflow:hidden;display:block">
    				</#if>
    			</div>
    			<div class="form-input col-md-2">
    				<label for="from">
	                    To:
	                </label>	
    				<#if endTime>
		            <input type="text"   name="endTime" data-trigger="focus" data-required="true" class="parsley-validated" value="${endTime}" onClick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})" style="clear:both;overflow:hidden;display:block">
		            <#else>
		            <input placeholder="结束时间" type="text"   name="endTime" data-trigger="focus" data-required="true" class="parsley-validated" value="" onClick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})" style="clear:both;overflow:hidden;display:block">
		            </#if>
		         </div>
    			<div class="form-input col-md-2" style="margin-top:16px;">
		        	<a href="javascript:;" class="btn large primary-bg radius-all-4" id="search" title="Validate!">
			            <span class="button-content">
			                查询
			            </span>
	                </a>
		        </div>
		        <div style="margin-top:15px;">
			        <a href="/stat/websiteexport/${startTime}&${endTime}" class="btn large primary-bg" title="">
			            <span class="button-content">导出Excel</span>
			        </a>
		        </div>
    		</div>
    	</form>
<table class="table" id="exp">
	    <thead>
	    <tr>
	    	<th>日期</th>
	        <th>产品线</th>
	        <th>提交用户</th>
	        <th>成功交易用户</th>
	        <th>新增成功交易用户</th>
	        <th>下单总数</th>
	        <th>成功交易订单</th>
	        <th>交易成功率</th>
	        <th>交易金额</th>
	        <th>注册用户</th>
	        <th>认证用户(绑卡)</th>
	    </tr>
	    </thead>
	    <tbody>
	    <#list result?keys as resultKey>
	    
	    <#list ["Web","H5","IOS","Android","All"]as source>
	    <#if source=="All">
	    <tr>
	    	<td style="color:red;">${resultKey}</td>
	        <td style="color:red;">${source}</td>
	        <td class="center" style="color:red;">${result[resultKey][source]["allBuyer"]}</td>
	        <td style="color:red;">${result[resultKey][source]["DAU"]}</td>
	        <td style="color:red;">${result[resultKey][source]["newDAU"]}</td>
	        <td class="center" style="color:red;">${result[resultKey][source]["allOrders"]}</td>
	        <td class="center" style="color:red;">${result[resultKey][source]["successOfOrder"]}</td>
	        <td class="center" style="color:red;">${result[resultKey][source]["rate"]}</td>
	        <td class="center" style="color:red;">${result[resultKey][source]["allSales"]}</td>
	        <td class="center" style="color:red;">${result[resultKey][source]["allUsers"]}</td>
	        <td class="center" style="color:red;">${result[resultKey][source]["certifyUsers"]}</td>
	    </tr>
	    <#else>
	    <tr>
	    	<td>${resultKey}</td>
	        <td>${source}</td>
	        <td class="center">${result[resultKey][source]["allBuyer"]}</td>
	        <td>${result[resultKey][source]["DAU"]}</td>
	        <td>${result[resultKey][source]["newDAU"]}</td>
	        <td class="center">${result[resultKey][source]["allOrders"]}</td>
	        <td class="center">${result[resultKey][source]["successOfOrder"]}</td>
	        <td class="center">${result[resultKey][source]["rate"]}</td>
	        <td class="center">${result[resultKey][source]["allSales"]}</td>
	        <td class="center">${result[resultKey][source]["allUsers"]}</td>
	        <td class="center">${result[resultKey][source]["certifyUsers"]}</td>
	    </tr>
	    </#if>
	    
	    </#list>
	    </#list>
	    </tbody>
	    <tfoot>
	    <tr>
	    	<th>日期</th>
	        <th>产品线</th>
	        <th>提交用户</th>
	        <th>成功交易用户</th>
	        <th>新增成功交易用户</th>
	        <th>下单总数</th>
	        <th>成功交易订单</th>
	        <th>交易成功率</th>
	        <th>交易金额</th>
	        <th>注册用户</th>
	        <th>认证用户(绑卡)</th>
	    </tr>
	    </tfoot>
	    </table>


</div>
</div>
<script type="text/javascript">
$(function(){
		$("#search").click(function(){
			$('#form').parsley('validate');
	    	$('#form').trigger('submit');
		});
	});

</script>